<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - PKU跳蚤市场</title>
    <link rel="icon" href="/images/logo.svg" type="image/svg+xml">
    <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/login.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="navbar-container">
            <a href="/" class="navbar-brand">PKU跳蚤市场</a>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="container">
        <div class="auth-container">
            <div class="auth-tabs">
                <div class="auth-tab active" data-form="login-form" onclick="switchTab(this)">登录</div>
                <div class="auth-tab" data-form="register-form" onclick="switchTab(this)">注册</div>
            </div>

            <!-- 登录表单 -->
            <form id="login-form" class="auth-form active" onsubmit="event.preventDefault(); login();">
                <div class="form-group">
                    <label class="form-label" for="login-email">邮箱</label>
                    <input type="email" id="login-email" class="form-input" placeholder="请输入北大邮箱" required>
                </div>
                <div class="form-group">
                    <label class="form-label" for="login-password">密码</label>
                    <input type="password" id="login-password" class="form-input" placeholder="请输入密码" required>
                </div>
                <div id="login-message" class="message" style="display: none;"></div>
                <button type="submit" class="submit-button">登录</button>
                <div class="form-footer">
                    <a href="#" class="change-password-link" onclick="showChangePasswordForm(); return false;">修改密码</a>
                </div>
            </form>

            <!-- 修改密码表单 -->
            <form id="change-password-form" class="auth-form" onsubmit="event.preventDefault(); changePassword();">
                <div class="form-group">
                    <label class="form-label" for="change-password-email">邮箱</label>
                    <input type="email" id="change-password-email" class="form-input" placeholder="请输入北大邮箱" required>
                </div>
                <div class="form-group">
                    <label class="form-label" for="change-password-old">旧密码</label>
                    <input type="password" id="change-password-old" class="form-input" placeholder="请输入旧密码" required>
                </div>
                <div class="form-group">
                    <label class="form-label" for="change-password-new">新密码</label>
                    <input type="password" id="change-password-new" class="form-input" placeholder="请输入新密码" required>
                    <div id="change-password-strength" class="password-strength"></div>
                </div>
                <div class="form-group">
                    <label class="form-label" for="change-password-confirm">确认新密码</label>
                    <input type="password" id="change-password-confirm" class="form-input" placeholder="请再次输入新密码" required>
                </div>
                <div id="change-password-message" class="message" style="display: none;"></div>
                <button type="submit" class="submit-button">确认修改</button>
                <div class="form-footer">
                    <a href="#" class="back-to-login" onclick="showLoginForm(); return false;">返回登录</a>
                </div>
            </form>

            <!-- 注册表单 -->
            <form id="register-form" class="auth-form" onsubmit="event.preventDefault(); register();">
                <div class="form-group">
                    <label class="form-label" for="register-email">邮箱</label>
                    <input type="email" id="register-email" class="form-input" placeholder="请输入北大邮箱" required>
                </div>
                <div class="form-group">
                    <label class="form-label" for="register-password">密码</label>
                    <input type="password" id="register-password" class="form-input" placeholder="请输入密码" required>
                    <div id="password-strength" class="password-strength"></div>
                </div>
                <div class="form-group">
                    <label class="form-label" for="register-confirm-password">确认密码</label>
                    <input type="password" id="register-confirm-password" class="form-input" placeholder="请再次输入密码" required>
                </div>
                <div class="form-group verification-group">
                    <label class="form-label" for="verification-code">验证码</label>
                    <div class="verification-input-group">
                        <input type="text" id="verification-code" class="form-input" placeholder="请输入验证码" required>
                        <button type="button" id="send-code-button" class="send-code-button" onclick="sendVerificationCode()">发送验证码</button>
                    </div>
                </div>
                <div id="register-message" class="message" style="display: none;"></div>
                <button type="submit" class="submit-button">注册</button>
            </form>
        </div>
    </div>

    <script src="/js/common.js"></script>
    <script src="/js/login.js"></script>
</body>
</html>
